jQuery(function(){
initTouchNav();
initSlideShow();
initLightbox();
});
function initSlideShow(){
jQuery('div.slideshow').fadeGallery({
slides: 'div.slide',
btnPrev: 'a.btn-prev',
btnNext: 'a.btn-next',
pagerLinks: '.pagination li',
event: 'click',
autoRotation: true,
autoHeight: true,
switchTime: 3000,
animSpeed: 500
});
}
function initLightbox(){
jQuery('a.lightbox, a[data-rel*="lightbox"]').each(function(){
var link=jQuery(this);
link.attr('rel', link.attr('data-rel')).fancybox({
padding: 15,
margin: 0,
cyclic: false,
autoScale: true,
overlayShow: true,
overlayOpacity: 0.65,
overlayColor: '#ffffff',
titlePosition: 'inside',
onComplete: function(box){
if(link.attr('href').indexOf('#')===0){
jQuery('#fancybox-content').find('a.close').unbind('click.fb').bind('click.fb', function(e){
jQuery.fancybox.close();
e.preventDefault();
});
}}
});
});
}
jQuery(function(){
var isTouchDevice=('ontouchstart' in window)||window.DocumentTouch&&document instanceof DocumentTouch;
var isMobile=$(window).width() <=768;
var isWinPhoneDevice=navigator.msPointerEnabled&&/MSIE 10.*Touch/.test(navigator.userAgent);
if(!isTouchDevice&&!isWinPhoneDevice&&!isMobile){
var head=document.getElementsByTagName('head')[0],
style=document.createElement('style'),
rules=document.createTextNode('#fancybox-overlay'+'{'+
'position:fixed;'+
'top:0;'+
'left:0;'+
'}');
style.type='text/css';
if(style.styleSheet){
style.styleSheet.cssText=rules.nodeValue;
}else{
style.appendChild(rules);
}
head.appendChild(style);
}});
function initTouchNav(){
jQuery('#nav').each(function(){
new TouchNav({
navBlock: this
});
});
}
;(function($){
function FadeGallery(options){
this.options=$.extend({
slides: 'ul.slideset > li',
activeClass:'active',
disabledClass:'disabled',
btnPrev: 'a.btn-prev',
btnNext: 'a.btn-next',
generatePagination: false,
pagerList: '
',
pagerListItem: ' ',
pagerListItemText: 'a',
pagerLinks: '.pagination li',
currentNumber: 'span.current-num',
totalNumber: 'span.total-num',
btnPlay: '.btn-play',
btnPause: '.btn-pause',
btnPlayPause: '.btn-play-pause',
galleryReadyClass: 'gallery-js-ready',
autorotationActiveClass: 'autorotation-active',
autorotationDisabledClass: 'autorotation-disabled',
autorotationStopAfterClick: false,
circularRotation: true,
switchSimultaneously: true,
disableWhileAnimating: false,
disableFadeIE: false,
autoRotation: false,
pauseOnHover: true,
autoHeight: false,
useSwipe: false,
swipeThreshold: 15,
switchTime: 4000,
animSpeed: 600,
event:'click'
}, options);
this.init();
}
FadeGallery.prototype={
init: function(){
if(this.options.holder){
this.findElements();
this.attachEvents();
this.refreshState(true);
this.autoRotate();
this.makeCallback('onInit', this);
}},
findElements: function(){
this.gallery=$(this.options.holder).addClass(this.options.galleryReadyClass);
this.slides=this.gallery.find(this.options.slides);
this.slidesHolder=this.slides.eq(0).parent();
this.stepsCount=this.slides.length;
this.btnPrev=this.gallery.find(this.options.btnPrev);
this.btnNext=this.gallery.find(this.options.btnNext);
this.currentIndex=0;
if(this.options.disableFadeIE&&!$.support.opacity){
this.options.animSpeed=0;
}
if(typeof this.options.generatePagination==='string'){
this.pagerHolder=this.gallery.find(this.options.generatePagination).empty();
this.pagerList=$(this.options.pagerList).appendTo(this.pagerHolder);
for(var i=0; i < this.stepsCount; i++){
$(this.options.pagerListItem).appendTo(this.pagerList).find(this.options.pagerListItemText).text(i+1);
}
this.pagerLinks=this.pagerList.children();
}else{
this.pagerLinks=this.gallery.find(this.options.pagerLinks);
}
var activeSlide=this.slides.filter('.'+this.options.activeClass);
if(activeSlide.length){
this.currentIndex=this.slides.index(activeSlide);
}
this.prevIndex=this.currentIndex;
this.btnPlay=this.gallery.find(this.options.btnPlay);
this.btnPause=this.gallery.find(this.options.btnPause);
this.btnPlayPause=this.gallery.find(this.options.btnPlayPause);
this.curNum=this.gallery.find(this.options.currentNumber);
this.allNum=this.gallery.find(this.options.totalNumber);
this.slides.css({display:'block',opacity:0}).eq(this.currentIndex).css({
opacity:''
});
},
attachEvents: function(){
var self=this;
this.resizeHandler=function(){
self.onWindowResize();
};
$(window).bind('load resize orientationchange', this.resizeHandler);
if(this.btnPrev.length){
this.btnPrevHandler=function(e){
e.preventDefault();
self.prevSlide();
if(self.options.autorotationStopAfterClick){
self.stopRotation();
}};
this.btnPrev.bind(this.options.event, this.btnPrevHandler);
}
if(this.btnNext.length){
this.btnNextHandler=function(e){
e.preventDefault();
self.nextSlide();
if(self.options.autorotationStopAfterClick){
self.stopRotation();
}};
this.btnNext.bind(this.options.event, this.btnNextHandler);
}
if(this.pagerLinks.length){
this.pagerLinksHandler=function(e){
e.preventDefault();
self.numSlide(self.pagerLinks.index(e.currentTarget));
if(self.options.autorotationStopAfterClick){
self.stopRotation();
}};
this.pagerLinks.bind(self.options.event, this.pagerLinksHandler);
}
if(this.btnPlay.length){
this.btnPlayHandler=function(e){
e.preventDefault();
self.startRotation();
};
this.btnPlay.bind(this.options.event, this.btnPlayHandler);
}
if(this.btnPause.length){
this.btnPauseHandler=function(e){
e.preventDefault();
self.stopRotation();
};
this.btnPause.bind(this.options.event, this.btnPauseHandler);
}
if(this.btnPlayPause.length){
this.btnPlayPauseHandler=function(e){
e.preventDefault();
if(!self.gallery.hasClass(self.options.autorotationActiveClass)){
self.startRotation();
}else{
self.stopRotation();
}};
this.btnPlayPause.bind(this.options.event, this.btnPlayPauseHandler);
}
if(this.options.useSwipe&&window.Hammer&&isTouchDevice){
this.swipeHandler=Hammer(this.gallery[0], {
dragBlockHorizontal: true,
dragMinDistance: 1
}).on('release dragleft dragright', function(e){
switch(e.type){
case 'dragleft':
case 'dragright':
e.gesture.preventDefault();
break;
case 'release':
if(e.gesture.distance > self.options.swipeThreshold){
if(e.gesture.direction==='left'){
self.nextSlide();
}else if(e.gesture.direction==='right'){
self.prevSlide();
}}
}});
}
if(this.options.pauseOnHover){
this.hoverHandler=function(){
if(self.options.autoRotation){
self.galleryHover=true;
self.pauseRotation();
}};
this.leaveHandler=function(){
if(self.options.autoRotation){
self.galleryHover=false;
self.resumeRotation();
}};
this.gallery.bind({mouseenter: this.hoverHandler, mouseleave: this.leaveHandler});
}},
onWindowResize: function(){
if(this.options.autoHeight){
this.slidesHolder.css({height: this.slides.eq(this.currentIndex).outerHeight(true) });
}},
prevSlide: function(){
if(!(this.options.disableWhileAnimating&&this.galleryAnimating)){
this.prevIndex=this.currentIndex;
if(this.currentIndex > 0){
this.currentIndex--;
this.switchSlide();
}else if(this.options.circularRotation){
this.currentIndex=this.stepsCount - 1;
this.switchSlide();
}}
},
nextSlide: function(fromAutoRotation){
if(!(this.options.disableWhileAnimating&&this.galleryAnimating)){
this.prevIndex=this.currentIndex;
if(this.currentIndex < this.stepsCount - 1){
this.currentIndex++;
this.switchSlide();
}else if(this.options.circularRotation||fromAutoRotation===true){
this.currentIndex=0;
this.switchSlide();
}}
},
numSlide: function(c){
if(this.currentIndex!=c){
this.prevIndex=this.currentIndex;
this.currentIndex=c;
this.switchSlide();
}},
switchSlide: function(){
var self=this;
if(this.slides.length > 1){
this.galleryAnimating=true;
if(!this.options.animSpeed){
this.slides.eq(this.prevIndex).css({opacity:0});
}else{
this.slides.eq(this.prevIndex).stop().animate({opacity:0},{duration: this.options.animSpeed});
}
this.switchNext=function(){
if(!self.options.animSpeed){
self.slides.eq(self.currentIndex).css({opacity:''});
}else{
self.slides.eq(self.currentIndex).stop().animate({opacity:1},{duration: self.options.animSpeed});
}
clearTimeout(this.nextTimer);
this.nextTimer=setTimeout(function(){
self.slides.eq(self.currentIndex).css({opacity:''});
self.galleryAnimating=false;
self.autoRotate();
self.makeCallback('onChange', self);
}, self.options.animSpeed);
};
if(this.options.switchSimultaneously){
self.switchNext();
}else{
clearTimeout(this.switchTimer);
this.switchTimer=setTimeout(function(){
self.switchNext();
}, this.options.animSpeed);
}
this.refreshState();
this.makeCallback('onBeforeChange', this);
}},
refreshState: function(initial){
this.slides.removeClass(this.options.activeClass).eq(this.currentIndex).addClass(this.options.activeClass);
this.pagerLinks.removeClass(this.options.activeClass).eq(this.currentIndex).addClass(this.options.activeClass);
this.curNum.html(this.currentIndex+1);
this.allNum.html(this.stepsCount);
if(this.options.autoHeight){
if(initial){
this.slidesHolder.css({height: this.slides.eq(this.currentIndex).outerHeight(true) });
}else{
this.slidesHolder.stop().animate({height: this.slides.eq(this.currentIndex).outerHeight(true)}, {duration: this.options.animSpeed});
}}
if(!this.options.circularRotation){
this.btnPrev.add(this.btnNext).removeClass(this.options.disabledClass);
if(this.currentIndex===0) this.btnPrev.addClass(this.options.disabledClass);
if(this.currentIndex===this.stepsCount - 1) this.btnNext.addClass(this.options.disabledClass);
}
this.gallery.toggleClass('not-enough-slides', this.stepsCount===1);
},
startRotation: function(){
this.options.autoRotation=true;
this.galleryHover=false;
this.autoRotationStopped=false;
this.resumeRotation();
},
stopRotation: function(){
this.galleryHover=true;
this.autoRotationStopped=true;
this.pauseRotation();
},
pauseRotation: function(){
this.gallery.addClass(this.options.autorotationDisabledClass);
this.gallery.removeClass(this.options.autorotationActiveClass);
clearTimeout(this.timer);
},
resumeRotation: function(){
if(!this.autoRotationStopped){
this.gallery.addClass(this.options.autorotationActiveClass);
this.gallery.removeClass(this.options.autorotationDisabledClass);
this.autoRotate();
}},
autoRotate: function(){
var self=this;
clearTimeout(this.timer);
if(this.options.autoRotation&&!this.galleryHover&&!this.autoRotationStopped){
this.gallery.addClass(this.options.autorotationActiveClass);
this.timer=setTimeout(function(){
self.nextSlide(true);
}, this.options.switchTime);
}else{
this.pauseRotation();
}},
makeCallback: function(name){
if(typeof this.options[name]==='function'){
var args=Array.prototype.slice.call(arguments);
args.shift();
this.options[name].apply(this, args);
}},
destroy: function(){
this.btnPrev.unbind(this.options.event, this.btnPrevHandler);
this.btnNext.unbind(this.options.event, this.btnNextHandler);
this.pagerLinks.unbind(this.options.event, this.pagerLinksHandler);
$(window).unbind('load resize orientationchange', this.resizeHandler);
this.stopRotation();
this.btnPlay.unbind(this.options.event, this.btnPlayHandler);
this.btnPause.unbind(this.options.event, this.btnPauseHandler);
this.btnPlayPause.unbind(this.options.event, this.btnPlayPauseHandler);
this.gallery.bind({mouseenter: this.hoverHandler, mouseleave: this.leaveHandler});
if(this.swipeHandler){
this.swipeHandler.dispose();
}
if(typeof this.options.generatePagination==='string'){
this.pagerHolder.empty();
}
var unneededClasses=[this.options.galleryReadyClass, this.options.autorotationActiveClass, this.options.autorotationDisabledClass];
this.gallery.removeClass(unneededClasses.join(' '));
this.slidesHolder.add(this.slides).removeAttr('style');
}};
var isTouchDevice=/MSIE 10.*Touch/.test(navigator.userAgent)||('ontouchstart' in window)||window.DocumentTouch&&document instanceof DocumentTouch;
$.fn.fadeGallery=function(opt){
return this.each(function(){
$(this).data('FadeGallery', new FadeGallery($.extend(opt,{holder:this})));
});
};}(jQuery));
function TouchNav(opt){
this.options={
hoverClass: 'hover',
menuItems: 'li',
menuOpener: 'a',
menuDrop: 'ul',
navBlock: null
};
for(var p in opt){
if(opt.hasOwnProperty(p)){
this.options[p]=opt[p];
}}
this.init();
}
TouchNav.isActiveOn=function(elem){
return elem&&elem.touchNavActive;
};
TouchNav.prototype={
init: function(){
if(typeof this.options.navBlock==='string'){
this.menu=document.getElementById(this.options.navBlock);
}else if(typeof this.options.navBlock==='object'){
this.menu=this.options.navBlock;
}
if(this.menu){
this.addEvents();
}},
addEvents: function(){
var self=this;
var touchEvent=(navigator.pointerEnabled&&'pointerdown')||(navigator.msPointerEnabled&&'MSPointerDown')||(this.isTouchDevice&&'touchstart');
this.menuItems=lib.queryElementsBySelector(this.options.menuItems, this.menu);
var initMenuItem=function(item){
var currentDrop=lib.queryElementsBySelector(self.options.menuDrop, item)[0],
currentOpener=lib.queryElementsBySelector(self.options.menuOpener, item)[0];
if(currentDrop&¤tOpener&&(self.isTouchDevice||self.isPointerDevice)){
lib.event.add(currentOpener, 'click', lib.bind(self.clickHandler, self));
lib.event.add(currentOpener, 'mousedown', lib.bind(self.mousedownHandler, self));
lib.event.add(currentOpener, touchEvent, function(e){
if(!self.isTouchPointerEvent(e)){
self.preventCurrentClick=false;
return;
}
self.touchFlag=true;
self.currentItem=item;
self.currentLink=currentOpener;
self.pressHandler.apply(self, arguments);
});
}
jQuery(item).bind('mouseenter', function(){
if(!self.touchFlag){
self.currentItem=item;
self.mouseoverHandler();
}});
jQuery(item).bind('mouseleave', function(){
if(!self.touchFlag){
self.currentItem=item;
self.mouseoutHandler();
}});
item.touchNavActive=true;
};
for(var i=0; i < this.menuItems.length; i++){
initMenuItem(self.menuItems[i]);
}
if(this.isTouchDevice||this.isPointerDevice){
lib.event.add(document.documentElement, 'mousedown', lib.bind(this.clickOutsideHandler, this));
lib.event.add(document.documentElement, touchEvent, lib.bind(this.clickOutsideHandler, this));
}},
mousedownHandler: function(e){
if(this.touchFlag){
e.preventDefault();
this.touchFlag=false;
this.preventCurrentClick=false;
}},
mouseoverHandler: function(){
lib.addClass(this.currentItem, this.options.hoverClass);
jQuery(this.currentItem).trigger('itemhover');
},
mouseoutHandler: function(){
lib.removeClass(this.currentItem, this.options.hoverClass);
jQuery(this.currentItem).trigger('itemleave');
},
hideActiveDropdown: function(){
for(var i=0; i < this.menuItems.length; i++){
if(lib.hasClass(this.menuItems[i], this.options.hoverClass)){
lib.removeClass(this.menuItems[i], this.options.hoverClass);
jQuery(this.menuItems[i]).trigger('itemleave');
}}
this.activeParent=null;
},
pressHandler: function(e){
if(this.currentItem!==this.activeParent){
if(this.activeParent&&this.currentItem.parentNode===this.activeParent.parentNode){
lib.removeClass(this.activeParent, this.options.hoverClass);
}else if(!this.isParent(this.activeParent, this.currentLink)){
this.hideActiveDropdown();
}}
this.activeParent=this.currentItem;
if(lib.hasClass(this.currentItem, this.options.hoverClass)){
this.preventCurrentClick=false;
}else{
e.preventDefault();
this.preventCurrentClick=true;
lib.addClass(this.currentItem, this.options.hoverClass);
jQuery(this.currentItem).trigger('itemhover');
}},
clickHandler: function(e){
if(this.preventCurrentClick){
e.preventDefault();
}},
clickOutsideHandler: function(event){
var e=event.changedTouches ? event.changedTouches[0]:event;
if(this.activeParent&&!this.isParent(this.menu, e.target)){
this.hideActiveDropdown();
this.touchFlag=false;
}},
isParent: function(parent, child){
while(child.parentNode){
if(child.parentNode==parent){
return true;
}
child=child.parentNode;
}
return false;
},
isTouchPointerEvent: function(e){
return (e.type.indexOf('touch') > -1) ||
(navigator.pointerEnabled&&e.pointerType==='touch') ||
(navigator.msPointerEnabled&&e.pointerType==e.MSPOINTER_TYPE_TOUCH);
},
isPointerDevice: (function(){
return !!(navigator.pointerEnabled||navigator.msPointerEnabled);
}()),
isTouchDevice: (function(){
return !!(('ontouchstart' in window)||window.DocumentTouch&&document instanceof DocumentTouch);
}())
};
lib={
hasClass: function(el,cls){
return el&&el.className ? el.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)')):false;
},
addClass: function(el,cls){
if(el&&!this.hasClass(el,cls)) el.className +=" "+cls;
},
removeClass: function(el,cls){
if(el&&this.hasClass(el,cls)){el.className=el.className.replace(new RegExp('(\\s|^)'+cls+'(\\s|$)'),' ');}},
extend: function(obj){
for(var i=1; i < arguments.length; i++){
for(var p in arguments[i]){
if(arguments[i].hasOwnProperty(p)){
obj[p]=arguments[i][p];
}}
}
return obj;
},
each: function(obj, callback){
var property, len;
if(typeof obj.length==='number'){
for(property=0, len=obj.length; property < len; property++){
if(callback.call(obj[property], property, obj[property])===false){
break;
}}
}else{
for(property in obj){
if(obj.hasOwnProperty(property)){
if(callback.call(obj[property], property, obj[property])===false){
break;
}}
}}
},
event: (function(){
var fixEvent=function(e){
e=e||window.event;
if(e.isFixed) return e; else e.isFixed=true;
if(!e.target) e.target=e.srcElement;
e.preventDefault=e.preventDefault||function(){this.returnValue=false;};
e.stopPropagation=e.stopPropagation||function(){this.cancelBubble=true;};
return e;
};
return {
add: function(elem, event, handler){
if(!elem.events){
elem.events={};
elem.handle=function(e){
var ret, handlers=elem.events[e.type];
e=fixEvent(e);
for(var i=0, len=handlers.length; i < len; i++){
if(handlers[i]){
ret=handlers[i].call(elem, e);
if(ret===false){
e.preventDefault();
e.stopPropagation();
}}
}};}
if(!elem.events[event]){
elem.events[event]=[];
if(elem.addEventListener) elem.addEventListener(event, elem.handle, false);
else if(elem.attachEvent) elem.attachEvent('on'+event, elem.handle);
}
elem.events[event].push(handler);
},
remove: function(elem, event, handler){
var handlers=elem.events[event];
for(var i=handlers.length - 1; i >=0; i--){
if(handlers[i]===handler){
handlers.splice(i,1);
}}
if(!handlers.length){
delete elem.events[event];
if(elem.removeEventListener) elem.removeEventListener(event, elem.handle, false);
else if(elem.detachEvent) elem.detachEvent('on'+event, elem.handle);
}}
};}()),
queryElementsBySelector: function(selector, scope){
scope=scope||document;
if(!selector) return [];
if(selector==='>*') return scope.children;
if(typeof document.querySelectorAll==='function'){
return scope.querySelectorAll(selector);
}
var selectors=selector.split(',');
var resultList=[];
for(var s=0; s < selectors.length; s++){
var currentContext=[scope||document];
var tokens=selectors[s].replace(/^\s+/,'').replace(/\s+$/,'').split(' ');
for (var i=0; i < tokens.length; i++){
token=tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');
if(token.indexOf('#') > -1){
var bits=token.split('#'), tagName=bits[0], id=bits[1];
var element=document.getElementById(id);
if(element&&tagName&&element.nodeName.toLowerCase()!=tagName){
return [];
}
currentContext=element ? [element]:[];
continue;
}
if(token.indexOf('.') > -1){
var bits=token.split('.'), tagName=bits[0]||'*', className=bits[1], found=[], foundCount=0;
for (var h=0; h < currentContext.length; h++){
var elements;
if(tagName=='*'){
elements=currentContext[h].getElementsByTagName('*');
}else{
elements=currentContext[h].getElementsByTagName(tagName);
}
for (var j=0; j < elements.length; j++){
found[foundCount++]=elements[j];
}}
currentContext=[];
var currentContextIndex=0;
for (var k=0; k < found.length; k++){
if(found[k].className&&found[k].className.match(new RegExp('(\\s|^)'+className+'(\\s|$)'))){
currentContext[currentContextIndex++]=found[k];
}}
continue;
}
if(token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)){
var tagName=RegExp.$1||'*', attrName=RegExp.$2, attrOperator=RegExp.$3, attrValue=RegExp.$4;
if(attrName.toLowerCase()=='for'&&this.browser.msie&&this.browser.version < 8){
attrName='htmlFor';
}
var found=[], foundCount=0;
for (var h=0; h < currentContext.length; h++){
var elements;
if(tagName=='*'){
elements=currentContext[h].getElementsByTagName('*');
}else{
elements=currentContext[h].getElementsByTagName(tagName);
}
for (var j=0; elements[j]; j++){
found[foundCount++]=elements[j];
}}
currentContext=[];
var currentContextIndex=0, checkFunction;
switch (attrOperator){
case '=': checkFunction=function(e){ return (e.getAttribute(attrName)==attrValue) }; break;
case '~': checkFunction=function(e){ return (e.getAttribute(attrName).match(new RegExp('(\\s|^)'+attrValue+'(\\s|$)'))) }; break;
case '|': checkFunction=function(e){ return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))) }; break;
case '^': checkFunction=function(e){ return (e.getAttribute(attrName).indexOf(attrValue)==0) }; break;
case '$': checkFunction=function(e){ return (e.getAttribute(attrName).lastIndexOf(attrValue)==e.getAttribute(attrName).length - attrValue.length) }; break;
case '*': checkFunction=function(e){ return (e.getAttribute(attrName).indexOf(attrValue) > -1) }; break;
default:checkFunction=function(e){ return e.getAttribute(attrName) };}
currentContext=[];
var currentContextIndex=0;
for (var k=0; k < found.length; k++){
if(checkFunction(found[k])){
currentContext[currentContextIndex++]=found[k];
}}
continue;
}
tagName=token;
var found=[], foundCount=0;
for (var h=0; h < currentContext.length; h++){
var elements=currentContext[h].getElementsByTagName(tagName);
for (var j=0; j < elements.length; j++){
found[foundCount++]=elements[j];
}}
currentContext=found;
}
resultList=[].concat(resultList,currentContext);
}
return resultList;
},
trim: function (str){
return str.replace(/^\s+/, '').replace(/\s+$/, '');
},
bind: function(f, scope, forceArgs){
return function(){return f.apply(scope, typeof forceArgs!=='undefined' ? [forceArgs]:arguments);};}};
!function(a,b){"use strict";function c(){d.READY||(s.determineEventTypes(),r.each(d.gestures,function(a){u.register(a)}),s.onTouch(d.DOCUMENT,n,u.detect),s.onTouch(d.DOCUMENT,o,u.detect),d.READY=!0)}var d=function v(a,b){return new v.Instance(a,b||{})};d.VERSION="1.1.3",d.defaults={behavior:{userSelect:"none",touchAction:"pan-y",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},d.DOCUMENT=document,d.HAS_POINTEREVENTS=navigator.pointerEnabled||navigator.msPointerEnabled,d.HAS_TOUCHEVENTS="ontouchstart"in a,d.IS_MOBILE=/mobile|tablet|ip(ad|hone|od)|android|silk/i.test(navigator.userAgent),d.NO_MOUSEEVENTS=d.HAS_TOUCHEVENTS&&d.IS_MOBILE||d.HAS_POINTEREVENTS,d.CALCULATE_INTERVAL=25;var e={},f=d.DIRECTION_DOWN="down",g=d.DIRECTION_LEFT="left",h=d.DIRECTION_UP="up",i=d.DIRECTION_RIGHT="right",j=d.POINTER_MOUSE="mouse",k=d.POINTER_TOUCH="touch",l=d.POINTER_PEN="pen",m=d.EVENT_START="start",n=d.EVENT_MOVE="move",o=d.EVENT_END="end",p=d.EVENT_RELEASE="release",q=d.EVENT_TOUCH="touch";d.READY=!1,d.plugins=d.plugins||{},d.gestures=d.gestures||{};var r=d.utils={extend:function(a,c,d){for(var e in c)!c.hasOwnProperty(e)||a[e]!==b&&d||(a[e]=c[e]);return a},on:function(a,b,c){a.addEventListener(b,c,!1)},off:function(a,b,c){a.removeEventListener(b,c,!1)},each:function(a,c,d){var e,f;if("forEach"in a)a.forEach(c,d);else if(a.length!==b){for(e=0,f=a.length;f>e;e++)if(c.call(d,a[e],e,a)===!1)return}else for(e in a)if(a.hasOwnProperty(e)&&c.call(d,a[e],e,a)===!1)return},inStr:function(a,b){return a.indexOf(b)>-1},inArray:function(a,b){if(a.indexOf){var c=a.indexOf(b);return-1===c?!1:c}for(var d=0,e=a.length;e>d;d++)if(a[d]===b)return d;return!1},toArray:function(a){return Array.prototype.slice.call(a,0)},hasParent:function(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1},getCenter:function(a){var b=[],c=[],d=[],e=[],f=Math.min,g=Math.max;return 1===a.length?{pageX:a[0].pageX,pageY:a[0].pageY,clientX:a[0].clientX,clientY:a[0].clientY}:(r.each(a,function(a){b.push(a.pageX),c.push(a.pageY),d.push(a.clientX),e.push(a.clientY)}),{pageX:(f.apply(Math,b)+g.apply(Math,b))/2,pageY:(f.apply(Math,c)+g.apply(Math,c))/2,clientX:(f.apply(Math,d)+g.apply(Math,d))/2,clientY:(f.apply(Math,e)+g.apply(Math,e))/2})},getVelocity:function(a,b,c){return{x:Math.abs(b/a)||0,y:Math.abs(c/a)||0}},getAngle:function(a,b){var c=b.clientX-a.clientX,d=b.clientY-a.clientY;return 180*Math.atan2(d,c)/Math.PI},getDirection:function(a,b){var c=Math.abs(a.clientX-b.clientX),d=Math.abs(a.clientY-b.clientY);return c>=d?a.clientX-b.clientX>0?g:i:a.clientY-b.clientY>0?h:f},getDistance:function(a,b){var c=b.clientX-a.clientX,d=b.clientY-a.clientY;return Math.sqrt(c*c+d*d)},getScale:function(a,b){return a.length>=2&&b.length>=2?this.getDistance(b[0],b[1])/this.getDistance(a[0],a[1]):1},getRotation:function(a,b){return a.length>=2&&b.length>=2?this.getAngle(b[1],b[0])-this.getAngle(a[1],a[0]):0},isVertical:function(a){return a==h||a==f},setPrefixedCss:function(a,b,c,d){var e=["","Webkit","Moz","O","ms"];b=r.toCamelCase(b);for(var f=0;f0&&this.started&&(g=n),this.started=!0;var j=this.collectEventData(c,g,e,a);return b!=o&&d.call(u,j),h&&(j.changedLength=i,j.eventType=h,d.call(u,j),j.eventType=g,delete j.changedLength),g==o&&(d.call(u,j),this.started=!1),g},determineEventTypes:function(){var b;return b=d.HAS_POINTEREVENTS?a.PointerEvent?["pointerdown","pointermove","pointerup pointercancel lostpointercapture"]:["MSPointerDown","MSPointerMove","MSPointerUp MSPointerCancel MSLostPointerCapture"]:d.NO_MOUSEEVENTS?["touchstart","touchmove","touchend touchcancel"]:["touchstart mousedown","touchmove mousemove","touchend touchcancel mouseup"],e[m]=b[0],e[n]=b[1],e[o]=b[2],e},getTouchList:function(a,b){if(d.HAS_POINTEREVENTS&&!(navigator.msPointerEnabled&&!navigator.pointerEnabled))return t.getTouchList();if(a.touches){if(b==n)return a.touches;var c=[],e=[].concat(r.toArray(a.touches),r.toArray(a.changedTouches)),f=[];return r.each(e,function(a){r.inArray(c,a.identifier)===!1&&f.push(a),c.push(a.identifier)}),f}return a.identifier=1,[a]},collectEventData:function(a,b,c,d){var e=k;return r.inStr(d.type,"mouse")||t.matchType(j,d)?e=j:t.matchType(l,d)&&(e=l),{center:r.getCenter(c),timeStamp:Date.now(),target:d.target,touches:c,eventType:b,pointerType:e,srcEvent:d,preventDefault:function(){var a=this.srcEvent;a.preventManipulation&&a.preventManipulation(),a.preventDefault&&a.preventDefault()},stopPropagation:function(){this.srcEvent.stopPropagation()},stopDetect:function(){return u.stopDetect()}}}},t=d.PointerEvent={pointers:{},getTouchList:function(){var a=[];return r.each(this.pointers,function(b){a.push(b)}),a},updatePointer:function(a,b){a==o||a!=o&&1!==b.buttons?delete this.pointers[b.pointerId]:(b.identifier=b.pointerId,this.pointers[b.pointerId]=b)},matchType:function(a,b){if(!b.pointerType)return!1;var c=b.pointerType,d={};return d[j]=c===(b.MSPOINTER_TYPE_MOUSE||j),d[k]=c===(b.MSPOINTER_TYPE_TOUCH||k),d[l]=c===(b.MSPOINTER_TYPE_PEN||l),d[a]},reset:function(){this.pointers={}}},u=d.detection={gestures:[],current:null,previous:null,stopped:!1,startDetect:function(a,b){this.current||(this.stopped=!1,this.current={inst:a,startEvent:r.extend({},b),lastEvent:!1,lastCalcEvent:!1,futureCalcEvent:!1,lastCalcData:{},name:""},this.detect(b))},detect:function(a){if(this.current&&!this.stopped){a=this.extendEventData(a);var b=this.current.inst,c=b.options;return r.each(this.gestures,function(d){!this.stopped&&b.enabled&&c[d.name]&&d.handler.call(d,a,b)},this),this.current&&(this.current.lastEvent=a),a.eventType==o&&this.stopDetect(),a}},stopDetect:function(){this.previous=r.extend({},this.current),this.current=null,this.stopped=!0},getCalculatedData:function(a,b,c,e,f){var g=this.current,h=!1,i=g.lastCalcEvent,j=g.lastCalcData;i&&a.timeStamp-i.timeStamp>d.CALCULATE_INTERVAL&&(b=i.center,c=a.timeStamp-i.timeStamp,e=a.center.clientX-i.center.clientX,f=a.center.clientY-i.center.clientY,h=!0),(a.eventType==q||a.eventType==p)&&(g.futureCalcEvent=a),(!g.lastCalcEvent||h)&&(j.velocity=r.getVelocity(c,e,f),j.angle=r.getAngle(b,a.center),j.direction=r.getDirection(b,a.center),g.lastCalcEvent=g.futureCalcEvent||a,g.futureCalcEvent=a),a.velocityX=j.velocity.x,a.velocityY=j.velocity.y,a.interimAngle=j.angle,a.interimDirection=j.direction},extendEventData:function(a){var b=this.current,c=b.startEvent,d=b.lastEvent||c;(a.eventType==q||a.eventType==p)&&(c.touches=[],r.each(a.touches,function(a){c.touches.push({clientX:a.clientX,clientY:a.clientY})}));var e=a.timeStamp-c.timeStamp,f=a.center.clientX-c.center.clientX,g=a.center.clientY-c.center.clientY;return this.getCalculatedData(a,d.center,e,f,g),r.extend(a,{startEvent:c,deltaTime:e,deltaX:f,deltaY:g,distance:r.getDistance(c.center,a.center),angle:r.getAngle(c.center,a.center),direction:r.getDirection(c.center,a.center),scale:r.getScale(c.touches,a.touches),rotation:r.getRotation(c.touches,a.touches)}),a},register:function(a){var c=a.defaults||{};return c[a.name]===b&&(c[a.name]=!0),r.extend(d.defaults,c,!0),a.index=a.index||1e3,this.gestures.push(a),this.gestures.sort(function(a,b){return a.indexb.index?1:0}),this.gestures}};d.Instance=function(a,b){var e=this;c(),this.element=a,this.enabled=!0,r.each(b,function(a,c){delete b[c],b[r.toCamelCase(c)]=a}),this.options=r.extend(r.extend({},d.defaults),b||{}),this.options.behavior&&r.toggleBehavior(this.element,this.options.behavior,!0),this.eventStartHandler=s.onTouch(a,m,function(a){e.enabled&&a.eventType==m?u.startDetect(e,a):a.eventType==q&&u.detect(a)}),this.eventHandlers=[]},d.Instance.prototype={on:function(a,b){var c=this;return s.on(c.element,a,b,function(a){c.eventHandlers.push({gesture:a,handler:b})}),c},off:function(a,b){var c=this;return s.off(c.element,a,b,function(a){var d=r.inArray({gesture:a,handler:b});d!==!1&&c.eventHandlers.splice(d,1)}),c},trigger:function(a,b){b||(b={});var c=d.DOCUMENT.createEvent("Event");c.initEvent(a,!0,!0),c.gesture=b;var e=this.element;return r.hasParent(b.target,e)&&(e=b.target),e.dispatchEvent(c),this},enable:function(a){return this.enabled=a,this},dispose:function(){var a,b;for(r.toggleBehavior(this.element,this.options.behavior,!1),a=-1;b=this.eventHandlers[++a];)r.off(this.element,b.gesture,b.handler);return this.eventHandlers=[],s.off(this.element,e[m],this.eventStartHandler),null}},function(a){function b(b,d){var e=u.current;if(!(d.options.dragMaxTouches>0&&b.touches.length>d.options.dragMaxTouches))switch(b.eventType){case m:c=!1;break;case n:if(b.distance0)){var k=Math.abs(d.options.dragMinDistance/b.distance);j.pageX+=b.deltaX*k,j.pageY+=b.deltaY*k,j.clientX+=b.deltaX*k,j.clientY+=b.deltaY*k,b=u.extendEventData(b)}(e.lastEvent.dragLockToAxis||d.options.dragLockToAxis&&d.options.dragLockMinDistance<=b.distance)&&(b.dragLockToAxis=!0);var l=e.lastEvent.direction;b.dragLockToAxis&&l!==b.direction&&(b.direction=r.isVertical(l)?b.deltaY<0?h:f:b.deltaX<0?g:i),c||(d.trigger(a+"start",b),c=!0),d.trigger(a,b),d.trigger(a+b.direction,b);var q=r.isVertical(b.direction);(d.options.dragBlockVertical&&q||d.options.dragBlockHorizontal&&!q)&&b.preventDefault();break;case p:c&&b.changedLength<=d.options.dragMaxTouches&&(d.trigger(a+"end",b),c=!1);break;case o:c=!1}}var c=!1;d.gestures.Drag={name:a,index:50,handler:b,defaults:{dragMinDistance:10,dragDistanceCorrection:!0,dragMaxTouches:1,dragBlockHorizontal:!1,dragBlockVertical:!1,dragLockToAxis:!1,dragLockMinDistance:25}}}("drag"),d.gestures.Gesture={name:"gesture",index:1337,handler:function(a,b){b.trigger(this.name,a)}},function(a){function b(b,d){var e=d.options,f=u.current;switch(b.eventType){case m:clearTimeout(c),f.name=a,c=setTimeout(function(){f&&f.name==a&&d.trigger(a,b)},e.holdTimeout);break;case n:b.distance>e.holdThreshold&&clearTimeout(c);break;case p:clearTimeout(c)}}var c;d.gestures.Hold={name:a,index:10,defaults:{holdTimeout:500,holdThreshold:2},handler:b}}("hold"),d.gestures.Release={name:"release",index:1/0,handler:function(a,b){a.eventType==p&&b.trigger(this.name,a)}},d.gestures.Swipe={name:"swipe",index:40,defaults:{swipeMinTouches:1,swipeMaxTouches:1,swipeVelocityX:.6,swipeVelocityY:.6},handler:function(a,b){if(a.eventType==p){var c=a.touches.length,d=b.options;if(cd.swipeMaxTouches)return;(a.velocityX>d.swipeVelocityX||a.velocityY>d.swipeVelocityY)&&(b.trigger(this.name,a),b.trigger(this.name+a.direction,a))}}},function(a){function b(b,d){var e,f,g=d.options,h=u.current,i=u.previous;switch(b.eventType){case m:c=!1;break;case n:c=c||b.distance>g.tapMaxDistance;break;case o:!r.inStr(b.srcEvent.type,"cancel")&&b.deltaTimed.options.transformMinRotation&&d.trigger("rotate",b),e>d.options.transformMinScale&&(d.trigger("pinch",b),d.trigger("pinch"+(b.scale<1?"in":"out"),b));break;case p:c&&b.changedLength<2&&(d.trigger(a+"end",b),c=!1)}}var c=!1;d.gestures.Transform={name:a,index:45,defaults:{transformMinScale:.01,transformMinRotation:1},handler:b}}("transform"),"function"==typeof define&&define.amd?define(function(){return d}):"undefined"!=typeof module&&module.exports?module.exports=d:a.Hammer=d}(window);
;(function(B){var L,T,Q,M,d,m,J,A,O,z,C=0,H={},j=[],e=0,G={},y=[],f=null,o=new Image(),i=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,k=/[^\.]\.(swf)\s*$/i,p,N=1,h=0,t="",b,c,P=false,s=B.extend(B("")[0],{prop:0}),S=/MSIE 6/.test(navigator.userAgent)&&B.browser.version<7&&!window.XMLHttpRequest,r=function(){T.hide();o.onerror=o.onload=null;if(f){f.abort()}L.empty()},x=function(){if(false===H.onError(j,C,H)){T.hide();P=false;return}H.titleShow=false;H.width="auto";H.height="auto";L.html('The requested content cannot be loaded.
Please try again later.
');n()},w=function(){var Z=j[C],W,Y,ab,aa,V,X;r();H=B.extend({},B.fn.fancybox.defaults,(typeof B(Z).data("fancybox")=="undefined"?H:B(Z).data("fancybox")));X=H.onStart(j,C,H);if(X===false){P=false;return}else{if(typeof X=="object"){H=B.extend(H,X)}}ab=H.title||(Z.nodeName?B(Z).attr("title"):Z.title)||"";if(Z.nodeName&&!H.orig){H.orig=B(Z).children("img:first").length?B(Z).children("img:first"):B(Z)}if(ab===""&&H.orig&&H.titleFromAlt){ab=H.orig.attr("alt")}W=H.href||(Z.nodeName?B(Z).attr("href"):Z.href)||null;if((/^(?:javascript)/i).test(W)||W=="#"){W=null}if(H.type){Y=H.type;if(!W){W=H.content}}else{if(H.content){Y="html"}else{if(W){if(W.match(i)){Y="image"}else{if(W.match(k)){Y="swf"}else{if(B(Z).hasClass("iframe")){Y="iframe"}else{if(W.indexOf("#")===0){Y="inline"}else{Y="ajax"}}}}}}}if(!Y){x();return}if(Y=="inline"){Z=W.substr(W.indexOf("#"));Y=B(Z).length>0?"inline":"ajax"}H.type=Y;H.href=W;H.title=ab;if(H.autoDimensions){if(H.type=="html"||H.type=="inline"||H.type=="ajax"){H.width="auto";H.height="auto"}else{H.autoDimensions=false}}if(H.modal){H.overlayShow=true;H.hideOnOverlayClick=false;H.hideOnContentClick=false;H.enableEscapeButton=false;H.showCloseButton=false}H.padding=parseInt(H.padding,10);H.margin=parseInt(H.margin,10);L.css("padding",(H.padding+H.margin));B(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){B(this).replaceWith(m.children())});switch(Y){case"html":L.html(H.content);n();break;case"inline":if(B(Z).parent().is("#fancybox-content")===true){P=false;return}B('').hide().insertBefore(B(Z)).bind("fancybox-cleanup",function(){B(this).replaceWith(m.children())}).bind("fancybox-cancel",function(){B(this).replaceWith(L.children())});B(Z).appendTo(L);n();break;case"image":P=false;B.fancybox.showActivity();o=new Image();o.onerror=function(){x()};o.onload=function(){P=true;o.onerror=o.onload=null;F()};o.src=W;break;case"swf":H.scrolling="no";aa='";L.html(aa);n();break;case"ajax":P=false;B.fancybox.showActivity();H.ajax.win=H.ajax.success;f=B.ajax(B.extend({},H.ajax,{url:W,data:H.ajax.data||{},dataType:"text",error:function(ac,ae,ad){if(ac.status>0){x()}},success:function(ad,af,ac){var ae=typeof ac=="object"?ac:f;if(ae.status==200||ae.status===0){if(typeof H.ajax.win=="function"){X=H.ajax.win(W,ad,af,ac);if(X===false){T.hide();return}else{if(typeof X=="string"||typeof X=="object"){ad=X}}}L.html(ad);n()}}}));break;case"iframe":E();break}},n=function(){var V=H.width,W=H.height;if(V.toString().indexOf("%")>-1){V=parseInt((B(window).width()-(H.margin*2))*parseFloat(V)/100,10)+"px"}else{V=V=="auto"?"auto":V+"px"}if(W.toString().indexOf("%")>-1){W=parseInt((B(window).height()-(H.margin*2))*parseFloat(W)/100,10)+"px"}else{W=W=="auto"?"auto":W+"px"}L.wrapInner('');H.width=L.width();H.height=L.height();E()},F=function(){H.width=o.width;H.height=o.height;B("").attr({id:"fancybox-img",src:o.src,alt:H.title}).appendTo(L);E()},E=function(){var W,V;T.hide();if(M.is(":visible")&&false===G.onCleanup(y,e,G)){B('.fancybox-inline-tmp').trigger('fancybox-cancel');P=false;return}P=true;B(m.add(Q)).unbind();B(window).unbind("resize.fb scroll.fb");B(document).unbind("keydown.fb");if(M.is(":visible")&&G.titlePosition!=="outside"){M.css("height",M.height())}y=j;e=C;G=H;if(G.overlayShow){Q.css({"background-color":G.overlayColor,opacity:G.overlayOpacity,cursor:G.hideOnOverlayClick?"pointer":"auto",height:B(document).height()});if(!Q.is(":visible")){if(S){B("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"})}Q.show()}}else{Q.hide()}c=R();l();if(M.is(":visible")){B(J.add(O).add(z)).hide();W=M.position(),b={top:W.top,left:W.left,width:M.width(),height:M.height()};V=(b.width==c.width&&b.height==c.height);m.fadeTo(G.changeFade,0.3,function(){var X=function(){m.html(L.contents()).fadeTo(G.changeFade,1,v)};B('.fancybox-inline-tmp').trigger('fancybox-change');m.empty().removeAttr("filter").css({"border-width":G.padding,width:c.width-G.padding*2,height:H.autoDimensions?"auto":c.height-h-G.padding*2});if(V){X()}else{s.prop=0;B(s).animate({prop:1},{duration:G.changeSpeed,easing:G.easingChange,step:U,complete:X})}});return}M.removeAttr("style");m.css("border-width",G.padding);if(G.transitionIn=="elastic"){b=I();m.html(L.contents());M.show();if(G.opacity){c.opacity=0}s.prop=0;B(s).animate({prop:1},{duration:G.speedIn,easing:G.easingIn,step:U,complete:v});return}if(G.titlePosition=="inside"&&h>0){A.show()}m.css({width:c.width-G.padding*2,height:H.autoDimensions?"auto":c.height-h-G.padding*2}).html(L.contents());M.css(c).fadeIn(G.transitionIn=="none"?0:G.speedIn,v)},D=function(V){if(V&&V.length){if(G.titlePosition=="float"){return''}return''+V+"
"}return false},l=function(){t=G.title||"";h=0;A.empty().removeAttr("style").removeClass();if(G.titleShow===false){A.hide();return}t=B.isFunction(G.titleFormat)?G.titleFormat(t,y,e,G):D(t);if(!t||t===""){A.hide();return}A.addClass("fancybox-title-"+G.titlePosition).html(t).appendTo("body").show();switch(G.titlePosition){case"inside":A.css({width:c.width-(G.padding*2),marginLeft:G.padding,marginRight:G.padding});h=A.outerHeight(true);A.appendTo(d);c.height+=h;break;case"over":A.css({marginLeft:G.padding,width:c.width-(G.padding*2),bottom:G.padding}).appendTo(d);break;case"float":A.css("left",parseInt((A.width()-c.width-40)/2,10)*-1).appendTo(M);break;default:A.css({width:c.width-(G.padding*2),paddingLeft:G.padding,paddingRight:G.padding}).appendTo(M);break}A.hide()},g=function(){if(G.enableEscapeButton||G.enableKeyboardNav){B(document).bind("keydown.fb",function(V){if(V.keyCode==27&&G.enableEscapeButton){V.preventDefault();B.fancybox.close()}else{if((V.keyCode==37||V.keyCode==39)&&G.enableKeyboardNav&&V.target.tagName!=="INPUT"&&V.target.tagName!=="TEXTAREA"&&V.target.tagName!=="SELECT"){V.preventDefault();B.fancybox[V.keyCode==37?"prev":"next"]()}}})}if(!G.showNavArrows){O.hide();z.hide();return}if((G.cyclic&&y.length>1)||e!==0){O.show()}if((G.cyclic&&y.length>1)||e!=(y.length-1)){z.show()}},v=function(){if(B.support.opacity===false){m.get(0).style.removeAttribute("filter");M.get(0).style.removeAttribute("filter")}if(H.autoDimensions){m.css("height","auto")}M.css("height","auto");if(t&&t.length){A.show()}if(G.showCloseButton){J.show()}g();if(G.hideOnContentClick){m.bind("click",B.fancybox.close)}if(G.hideOnOverlayClick){Q.bind("click",B.fancybox.close)}B(window).bind("resize.fb",B.fancybox.resize);if(G.centerOnScroll){B(window).bind("scroll.fb",B.fancybox.center)}if(G.type=="iframe"){B('').appendTo(m)}M.show();P=false;B.fancybox.center();G.onComplete(y,e,G);K()},K=function(){var V,W;if((y.length-1)>e){V=y[e+1].href;if(typeof V!=="undefined"&&V.match(i)){W=new Image();W.src=V}}if(e>0){V=y[e-1].href;if(typeof V!=="undefined"&&V.match(i)){W=new Image();W.src=V}}},U=function(W){var V={width:parseInt(b.width+(c.width-b.width)*W,10),height:parseInt(b.height+(c.height-b.height)*W,10),top:parseInt(b.top+(c.top-b.top)*W,10),left:parseInt(b.left+(c.left-b.left)*W,10)};if(typeof c.opacity!=="undefined"){V.opacity=W<0.5?0.5:W}M.css(V);m.css({width:V.width-G.padding*2,height:V.height-(h*W)-G.padding*2})},u=function(){return[B(window).width()-(G.margin*2),B(window).height()-(G.margin*2),B(document).scrollLeft()+G.margin,B(document).scrollTop()+G.margin]},R=function(){var V=u(),Z={},W=G.autoScale,X=G.padding*2,Y;if(G.width.toString().indexOf("%")>-1){Z.width=parseInt((V[0]*parseFloat(G.width))/100,10)}else{Z.width=G.width+X}if(G.height.toString().indexOf("%")>-1){Z.height=parseInt((V[1]*parseFloat(G.height))/100,10)}else{Z.height=G.height+X}if(W&&(Z.width>V[0]||Z.height>V[1])){if(H.type=="image"||H.type=="swf"){Y=(G.width)/(G.height);if((Z.width)>V[0]){Z.width=V[0];Z.height=parseInt(((Z.width-X)/Y)+X,10)}if((Z.height)>V[1]){Z.height=V[1];Z.width=parseInt(((Z.height-X)*Y)+X,10)}}else{Z.width=Math.min(Z.width,V[0]);Z.height=Math.min(Z.height,V[1])}}Z.top=parseInt(Math.max(V[3]-20,V[3]+((V[1]-Z.height-40)*0.5)),10);Z.left=parseInt(Math.max(V[2]-20,V[2]+((V[0]-Z.width-40)*0.5)),10);return Z},q=function(V){var W=V.offset();W.top+=parseInt(V.css("paddingTop"),10)||0;W.left+=parseInt(V.css("paddingLeft"),10)||0;W.top+=parseInt(V.css("border-top-width"),10)||0;W.left+=parseInt(V.css("border-left-width"),10)||0;W.width=V.width();W.height=V.height();return W},I=function(){var Y=H.orig?B(H.orig):false,X={},W,V;if(Y&&Y.length){W=q(Y);X={width:W.width+(G.padding*2),height:W.height+(G.padding*2),top:W.top-G.padding-20,left:W.left-G.padding-20}}else{V=u();X={width:G.padding*2,height:G.padding*2,top:parseInt(V[3]+V[1]*0.5,10),left:parseInt(V[2]+V[0]*0.5,10)}}return X},a=function(){if(!T.is(":visible")){clearInterval(p);return}B("div",T).css("top",(N*-40)+"px");N=(N+1)%12};B.fn.fancybox=function(V){if(!B(this).length){return this}B(this).data("fancybox",B.extend({},V,(B.metadata?B(this).metadata():{}))).unbind("click.fb").bind("click.fb",function(X){X.preventDefault();if(P){return}P=true;B(this).blur();j=[];C=0;var W=B(this).attr("rel")||"";if(!W||W==""||W==="nofollow"){j.push(this)}else{j=B('a[rel="'+W+'"], area[rel="'+W+'"]');C=j.index(this)}w();return});return this};B.fancybox=function(Y){var X;if(P){return}P=true;X=typeof arguments[1]!=="undefined"?arguments[1]:{};j=[];C=parseInt(X.index,10)||0;if(B.isArray(Y)){for(var W=0,V=Y.length;Wj.length||C<0){C=0}w()};B.fancybox.showActivity=function(){clearInterval(p);T.show();p=setInterval(a,66)};B.fancybox.hideActivity=function(){T.hide()};B.fancybox.next=function(){return B.fancybox.pos(e+1)};B.fancybox.prev=function(){return B.fancybox.pos(e-1)};B.fancybox.pos=function(V){if(P){return}V=parseInt(V);j=y;if(V>-1&&V1){C=V>=y.length?0:y.length-1;w()}}return};B.fancybox.cancel=function(){if(P){return}P=true;B('.fancybox-inline-tmp').trigger('fancybox-cancel');r();H.onCancel(j,C,H);P=false};B.fancybox.close=function(){if(P||M.is(":hidden")){return}P=true;if(G&&false===G.onCleanup(y,e,G)){P=false;return}r();B(J.add(O).add(z)).hide();B(m.add(Q)).unbind();B(window).unbind("resize.fb scroll.fb");B(document).unbind("keydown.fb");if(G.type==="iframe"){m.find("iframe").attr("src",S&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")}if(G.titlePosition!=="inside"){A.empty()}M.stop();function V(){Q.fadeOut("fast");A.empty().hide();M.hide();B('.fancybox-inline-tmp').trigger('fancybox-cleanup');m.empty();G.onClosed(y,e,G);y=H=[];e=C=0;G=H={};P=false}if(G.transitionOut=="elastic"){b=I();var W=M.position();c={top:W.top,left:W.left,width:M.width(),height:M.height()};if(G.opacity){c.opacity=1}A.empty().hide();s.prop=1;B(s).animate({prop:0},{duration:G.speedOut,easing:G.easingOut,step:U,complete:V})}else{M.fadeOut(G.transitionOut=="none"?0:G.speedOut,V)}};B.fancybox.resize=function(){if(Q.is(":visible")){Q.css("height",B(document).height())}B.fancybox.center(true)};B.fancybox.center=function(){var V,W;if(P){return}W=arguments[0]===true?1:0;V=u();if(!W&&(M.width()>V[0]||M.height()>V[1])){return}M.stop().animate({top:parseInt(Math.max(V[3]-20,V[3]+((V[1]-m.height()-40)*0.5)-G.padding)),left:parseInt(Math.max(V[2]-20,V[2]+((V[0]-m.width()-40)*0.5)-G.padding))},typeof arguments[0]=="number"?arguments[0]:200)};B.fancybox.init=function(){if(B("#fancybox-wrap").length){return}B("body").append(L=B(''),T=B(''),Q=B(''),M=B(''));d=B('').append('').appendTo(M);d.append(m=B(''),J=B(''),A=B(''),O=B(''),z=B(''));J.click(B.fancybox.close);T.click(B.fancybox.cancel);O.click(function(V){V.preventDefault();B.fancybox.prev()});z.click(function(V){V.preventDefault();B.fancybox.next()});if(B.fn.mousewheel){M.bind("mousewheel.fb",function(V,W){if(P){V.preventDefault()}else{if(B(V.target).get(0).clientHeight==0||B(V.target).get(0).scrollHeight===B(V.target).get(0).clientHeight){V.preventDefault();B.fancybox[W>0?"prev":"next"]()}}})}if(B.support.opacity===false){M.addClass("fancybox-ie")}if(S){T.addClass("fancybox-ie6");M.addClass("fancybox-ie6");B('').prependTo(d)}};B.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};B(document).ready(function(){B.fancybox.init()})})(jQuery);
function updateDisplay(){
if($(document).width() <=768){
$('body').addClass('mobile');
}else if($(document).width() <=992){
$('body').addClass('tablet');
}else{
$('body').removeClass('mobile');
$('body').removeClass('tablet');
}}
function toggleMenu(show){
if(show){
var MAX_SIZE=50;
var num=$('#nav > ul > li').length;
var h=$(window).height() / (num*2);
if(h > MAX_SIZE) h=MAX_SIZE;
$('#nav > ul > li').css('font-size', h);
$('#nav').show();
}else{
$('#nav').hide();
}}
function updateLogo(){
if(jQuery(window).width() > 992){
m=120;
ls=jQuery("#header .logo").width();
ws=jQuery(window).width();
d=(ws - ls) / 2;
if(d - 15 < m)
m=d - 15;
jQuery("#header .logo a").css("margin-left", (-1 * m));
}else{
jQuery("#header .logo a").css("margin-left", 0);
}}
$(document).ready(function(){
var isMobile=$(window).width() <=768;
updateDisplay();
$(window).resize(updateDisplay);
/*$('#menu-btn').toggle(function(){
toggleMenu(true);
},function(){
toggleMenu(false);
});*/
if($(window).width() < 992){
var jPM=$.jPanelMenu({
menu: '#nav',
trigger: '#menu-btn'
});
jPM.on();
}
/*
if(!isMobile){
var jLink=jQuery('#menu-item-45 > a, aside.aside .info-link .mail, a[href$="/kontaktformular/"]').addClass('iframe').addClass('contactOverlay').attr('href', '/kontaktformular/');
jLink.attr('rel', jLink.attr('data-rel')).fancybox({autoDimensions: false,width: 750,height: 750,padding: 0,margin: 0,cyclic: false,autoScale: true,overlayShow: true,overlayOpacity: 0.65,overlayColor: '#ffffff',titlePosition: 'inside',
onComplete: function(box){
if(jLink.attr('href').indexOf('#')===0){
jQuery('#fancybox-content').find('a.close').unbind('click.fb').bind('click.fb', function(e){
jQuery.fancybox.close();
e.preventDefault();
});
}}
});
}*/
jQuery('.jPanelMenu, body').css('overflow-x', 'visible');
jQuery('.info-link .top').click(function(evt){
evt.preventDefault();
jQuery('html,body').animate({ scrollTop: 0}, 'slow');
});
if(isMobile){
$('a.lightbox.nomobile').click(function(e){
e.preventDefault();
var iframe=$($(this).attr('href')+' iframe')[0];
var url=(iframe) ? ((typeof $(iframe).attr('rel')!==typeof undefined) ? $(iframe).attr('rel'):null):null;
if(url){
location.href=url;
}
return false;
});
}
updateLogo();
jQuery(window).resize(function(){ updateLogo(); });
jQuery(function(){
var jMain=jQuery('#nav');
var checkScrollTop=function(){
var iScrollTop=jQuery(document).scrollTop();
jMain[((iScrollTop > 158) ? 'add':'remove') + 'Class']('fixed');
};
jQuery(document).on('scroll', checkScrollTop);
checkScrollTop();
});
$('.iframe-popup').magnificPopup({type:'iframe'});
});